import sys


sys.path.append("../lib")
from inner_util import read_from_xlsx, write_to_xlsx, clean_text


def clean_row(row):
    return [clean_text(x) for x in row]


def read_data(file_path):
    data = read_from_xlsx(file_path)

    depart = ""
    new_data = []
    for row in data:
        if row[1] is not None:
            depart = clean_text(row[1])
            print("dep", depart)
            new_data.append(clean_row(row))
        else:
            new_row = list(row)
            new_row[1] = depart
            print("new", new_row)
            new_data.append(clean_row(new_row))

    write_to_xlsx("bb.xlsx", new_data)


if __name__ == "__main__":
    read_data("aa.xlsx")
